package java7;  


  
class Course {
	int number;  
    String site;  
    String time;  
    Teacher t;  
Course(int number,String site,String time,Teacher t) {
	setNumber(number);  
    setSite(site);  
    setTime(time);  
    this.t = t;  
}  
void setNumber(int number) {
	this.number = number;  
}  
void setSite(String site) {
	this.site = site;  
}  
void setTime(String time) {
	this.time = time;  
}  
public String toString() { 
	return "课程编号:"+ number +" 课程名称:"+t.TeachLesson+" 上课地点:"+site+" 时间:"+time;  
}  
} 
 
class People{ 
    private int code; 
    private String name; 
    private char sex; 
People(int code, String name, char sex){ 
    setCode(code); 
    setName(name); 
    setSex(sex); 
} 
int getCode(){ 
    return code; 
} 
String getName(){ 
    return name; 
} 
char getSex(){ 
    return sex; 
} 
void setCode(int code){ 
    this.code = code; 
} 
void setName(String name){ 
    this.name = name; 
} 
void setSex(char sex){ 
    this.sex = sex; 
} 
} 
  
class Student extends People{
	String LearnLesson;
	private Teacher name;
	private Course site;
    Student(int code,String name,char sex, Teacher t,Course c){
        super(code,name,sex); 

        this.name = t ;
        this.site=c;

} 
String getLearnLesson(){ 
	return LearnLesson; 
} 
void setLearnLesson(String LearnLesson){
	this.LearnLesson = LearnLesson; 
}

public String toString(){
	return"学生编号:"+getCode()+"学生姓名:"+getName()+"性别:"+getSex()+"授课老师："+name.name+this.site; 
} 
} 
 
class Teacher extends People {
	String TeachLesson;  
    String name;  
    Teacher(int code, String name, char sex, String lesson) {
    	super(code, name, sex); 
    	this.TeachLesson = lesson; 
        this.name=name;
        setName(name);  
}  
    public String toString() {
    	return "教师编号:" + getCode() + " 教师姓名:" + getName() + " 性别:" + getSex() + " 所授课程:" + TeachLesson;  
}  
} 

 
public class Test {

	public static void main(String[] args) {
		Teacher t1= new Teacher(1, "王老师", '男', "C++"); 
        Course c1 = new Course(13, "101", "7:50", t1);
		Student s1 = new Student(1, "yx", '女',t1, c1);  
        Teacher t2=new Teacher(2, "李老师", '女', "Python");
		Course c2=new Course(20, "102", "9:40", t2);
		Student s2 = new Student(2, "Emma", '女',t2,c2);
        Teacher t3=new Teacher(3, "张老师", '男', "JAVA");
        Course c3 = new Course(21, "103", "13:30", t3);
        Student s3 = new Student(2, "lihua", '男',t2,c3);
System.out.println("教师信息:\n" + t1 + "\n" + t2 + "\n" + t3);  
System.out.println("学生信息:\n" + s1 + "\n" + s2 + "\n" + s3);  
} 
	
	
	
} 